Skip to content

feat(worker): public APIs, per-job concurrency, and terminal status rendering#1071

Open
eideroliveira wants to merge 1 commit into
qor5:mainfrom
eideroliveira:pr/worker-enhancements
Open

feat(worker): public APIs, per-job concurrency, and terminal status rendering#1071
eideroliveira wants to merge 1 commit into
qor5:mainfrom
eideroliveira:pr/worker-enhancements

Conversation

@eideroliveira
Copy link
Copy Markdown
Contributor

Summary

Extends the worker package with public APIs needed to build job orchestration outside the admin UI, and fixes rendering issues with terminal job statuses.

Public API additions:

  • Builder.GetQueue() — exposes the queue for external orchestration
  • Builder.GetJobBuilder(name) — public accessor for job builders by name
  • Builder.CreateJob(ctx, qorJob) — public job creation with web context
  • Builder.CreateSystemJob(ctx, jobName, args) — create jobs from system background without web context (cron, startup tasks, etc.)
  • JobBuilder.Concurrency(n) — configure max concurrent instances per job type (propagated to queue listener)
  • JobBuilder.GetResource() — access the resource prototype
  • QorJobInstance.SetJobBuilder(jb) — wire job builders externally

Behavior improvements:

  • Terminal statuses (done/exception/killed/cancelled) render job progress directly instead of through the async portal — avoids Vue template compiler errors when ProgressText contains raw HTML
  • Progress text and log lines wrapped with v-pre to prevent Vue interpolation of user content
  • Completed jobs reload the page to reflect final state
  • Rerun button shown on both done and exception statuses
  • Guard nil request when extracting operator in newJobInstance

Test plan

  • Jobs created via CreateSystemJob (no web context) execute correctly
  • Per-job concurrency limits are respected by the queue
  • Terminal job statuses render without Vue template compilation errors
  • Progress text containing HTML renders safely with v-pre
  • Page reloads after job completion to reflect updated state

…nal status rendering

Public API additions:
- Builder.GetQueue() — exposes the queue for external orchestration
- Builder.GetJobBuilder(name) — public accessor for job builders
- Builder.CreateJob(ctx, qorJob) — public job creation with web context
- Builder.CreateSystemJob(ctx, jobName, args) — create jobs from system
  background without web context (e.g. cron, startup tasks)
- JobBuilder.Concurrency(n) — configure max concurrent instances per job
- JobBuilder.GetResource() — access the resource prototype
- QorJobInstance.SetJobBuilder(jb) — allows external code to wire job builders

Worker behavior improvements:
- Concurrency propagated through QorJobDefinition to queue listener
- Terminal statuses (done/exception/killed/cancelled) now render directly
  instead of through async portal, avoiding Vue template compiler errors
  when progressText contains raw HTML
- Job logs fetched via extracted fetchJobLogs helper
- Progress text and log lines wrapped with v-pre to prevent Vue interpolation
  of user-supplied content
- Completed jobs now reload the page to reflect final state
- Rerun button shown on both done and exception statuses
- Guard nil request in newJobInstance operator extraction
@deepsource-io
Copy link
Copy Markdown

deepsource-io Bot commented May 8, 2026

DeepSource Code Review

We reviewed changes in a72f7fd...888b9c9 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
Go May 8, 2026 5:23p.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant